<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <title>注册</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <script type="text/javascript" src="./public/js/jquery-3.1.1.min.js"></script>

    </head>
    <body>
        <a href="index.php?m=index&c=user&a=list2" ></a>
        <div id="background">
            编号<input type="text" name="id" id="id"/><br/><br/>
            标题<input type="text" name="title" id="title"/><br/><br/>
            内容<input type="text" name="content" id="content"/><br/><br/>
            时间<input type="text" name="add_time" id="add_time"/><br/><br/>
            点击量<input type="text" name="click" id="click"/><br/><br/>
                <a href="javascript:;" class="button">发帖</a>
        </div>
    </body>
</html>
<script type="text/javascript"> 
    {literal}
            $(".button").click(function(){
                var id = $(".id").val();
                var title = $(".title").val();
                var content = $(".content").val();
                var add_time = $(".add_time").val();
                var click = $(".click").val();
                $.ajax({
                    type:"get",
                    url:"./index.php?m=index&c=user&a=addUser1",
                    data:{id:id,title:title,content:content,add_time:add_time,click:click},
                    success:function(a){
                       if(a == 1) {
                                   alert("添加成功");
                                   window.location.href="./index.php?m=index&c=user&a=list2";
                               }else{
                                  alert("添加失败");   
                    }
                    
                }          
            })
        })
    {/literal}
 
</script>
